/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.itu.beans;

import java.io.Serializable;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
import org.apache.log4j.Logger;

/**
 *
 * @author amin
 */
@ManagedBean
@SessionScoped
public class LoginBean implements Serializable {

    private static Logger logger = Logger.getLogger(LoginBean.class);
    private String userName;
    private String password;

    public LoginBean() {
    }

    public String validateUser() {
        logger.info(" - echo user is trying to loggin, " + "User-name:  "+ userName);
        
        if (userName.equals("admin") && password.equals("guest")) {
            return "viewguest.xhtml";
        } else {
            return "error.xhtml";
        }
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }
}
